/* @(#)GSProviderAddAction.java    V0.1
*
* Project: GSdevelop
*
* Modify Information:
* =============================================================================
*   Author       Date       Description
*   ------------ ---------- ---------------------------------------------------
*   owen         2006-2-27
*
* Copyright Notice:
* =============================================================================
*    Copyright (c) 2001-2006 Beijing HiTRUST Technology Co., Ltd. 1808 Room, 
*        Science & Technology Building, No. 9 South Street, Zhong Guan Cun, 
*        Haidian District, Beijing ,100081, China All rights reserved.
*
*    This software is the confidential and proprietary information of
*        Beijing HiTRUST Technology Co., Ltd. ("Confidential Information").
*        You shall not disclose such Confidential Information and shall use it
*        only in accordance with the terms of the license agreement you entered
*        into with HiTRUST.
*
* Warning:
* =============================================================================
* 
*/
package com.hitrust.gs.action;

import java.util.ArrayList;
import java.util.HashMap;

import org.apache.commons.beanutils.BeanUtils;

import com.hitrust.gs.bean.GSProviderBean;
import com.hitrust.gs.form.GSProviderAddForm;
import com.hitrust.gs.lib.GSBaseConstants;
import com.hitrust.gs.service.GSBaseAction;
import com.hitrust.gs.service.GSBaseForm;
import com.hitrust.gs.service.GSBaseManager;
import com.hitrust.gs.util.exception.GSException;
import com.hitrust.gs.business.GSProviderProcessor;


/**
* 添加供应商
*/
public class GSDeliverProviderAddAction extends GSBaseAction{

   
   public String execute(GSBaseForm aForm) throws Exception {
       GSProviderAddForm tForm = (GSProviderAddForm)aForm;
       try{
       		GSProviderBean tGSProviderBean=new GSProviderBean();
       		BeanUtils.copyProperties(tGSProviderBean,tForm);
       		//不是交易平台导入
       		tGSProviderBean.setGs_is_tradeflat_provider("1");
       		//添加供应商
       		//GSProviderProcessor.addTask(tGSProviderBean);
			aForm.getRequest().setAttribute("addOk","true");
       }
       catch (Exception err) {
           if(err!= null ) { 
               aForm.getRequest().setAttribute("message","新增供应商不成功,请重新录入供应商信息!");               
               return GSBaseConstants.FORWARD_SUCCESS;
           } 
		   aForm.getRequest().setAttribute("addOk","false");
       }
       aForm.getRequest().setAttribute("message", "新增供应商成功!");	   
       aForm.getRequest().setAttribute("requery","true");
       
       //取得所有国家
       ArrayList tList = GSBaseManager.getAllCountry();
       aForm.getRequest().setAttribute("country",tList);
       //取得所有省
       tList = GSBaseManager.getAllProvince();
       aForm.getRequest().setAttribute("province",tList);
       //取得所有地区
       tList = GSBaseManager.getAllDistinct();
       aForm.getRequest().setAttribute("district",tList);
       //取得公司性质
       String[][] tStr= GSBaseManager.getAllCorpProperty();
       aForm.getRequest().setAttribute("corpproperty",tStr);
       
       return GSBaseConstants.FORWARD_SUCCESS;
   }
}

